

package com.hazelcast.client.impl.protocol.codec.builtin;

import com.hazelcast.client.impl.protocol.ClientMessage;

import java.nio.charset.StandardCharsets;

public final class StringCodec {

    private StringCodec() {
    }

    public static void encode(ClientMessage clientMessage, String value) {
        clientMessage.add(new ClientMessage.Frame(value.getBytes(StandardCharsets.UTF_8)));
    }

    public static String decode(ClientMessage.ForwardFrameIterator iterator) {
        return new String(iterator.next().content, StandardCharsets.UTF_8);
    }
}
